package test.library.behavior;

import test.library.Book;
import test.library.BookList;

import java.util.Scanner;

public class AddBook implements IBehavior{
    public void work(BookList bookList){
        System.out.println("添加书籍");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入书名:");
        String name =scanner.next();
        System.out.println("请输入作者:");
        String author =scanner.next();
        System.out.println("请输入类型:");
        String type =scanner.next();
        System.out.println("请输入单价:");
        int price =scanner.nextInt();
        Book book = new Book(name,author,type,price);
        bookList.setBook(bookList.getQuantity(),book);
        bookList.setQuantity(bookList.getQuantity() + 1);
        System.out.println("已添加");
    }
}
